<?php

namespace JLPay\Models\Ledger\Merchconf;

/**
 * 绑定信息
 */
class Bind
{
    protected ?string $revMchId = null;
    protected ?string $notifyUrl = null;
    protected ?string $sourceIds = null;

    /**
     * 构造函数
     *
     * @param array|null $bindArray
     */
    public function __construct(?array $bindArray = null)
    {
        if ($bindArray) {
            $this->revMchId = $bindArray['rev_mch_id'] ?? null;
            $this->notifyUrl = $bindArray['notify_url'] ?? null;
            $this->sourceIds = $bindArray['source_ids'] ?? null;
        }
    }

    /**
     * 获取接收方商户号
     *
     * @return string|null
     */
    public function getRevMchId(): ?string
    {
        return $this->revMchId;
    }

    /**
     * 获取通知URL
     *
     * @return string|null
     */
    public function getNotifyUrl(): ?string
    {
        return $this->notifyUrl;
    }

    /**
     * 获取来源ID列表
     *
     * @return string|null
     */
    public function getSourceIds(): ?string
    {
        return $this->sourceIds;
    }

    /**
     * 转换为数组
     *
     * @return array
     */
    public function toArray(): array
    {
        return [
            'rev_mch_id' => $this->revMchId,
            'notify_url' => $this->notifyUrl,
            'source_ids' => $this->sourceIds,
        ];
    }
} 